﻿using System;
using System.Diagnostics;
using System.ServiceModel;
using FullDuplexServiceExample.ServiceTest.MySvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace FullDuplexServiceExample.ServiceTest
{
	[TestClass]
	public class MySvcTest
	{
		public class MyCallback : IMyServiceCallback
		{
			public void ResponseToSentMsg(MyMsg msg)
			{
				Debug.WriteLine(msg.Text);
			}
		}

		private readonly MyCallback _callback;
		private readonly MySvc.MyServiceClient _proxy;

		public MySvcTest ()
		{
			_callback = new MyCallback();
			_proxy = new MyServiceClient(new InstanceContext(_callback));
		}

		[TestMethod]
		public void TestSendMsg()
		{
			_proxy.SendMsg(new MyMsg { Time = DateTime.Now, Text = "Test" });
			Assert.IsNotNull(_proxy);
		}
	}
}
